package com.wangzaiplus.test.designpattern.yuanxing;

import lombok.Data;

/**
 * @ClassName ProtoTypeCitation
 * @Description: TODO
 * @Author wgc
 * @Date 2020/06/17 10:16
 * @Version V1.0
 **/
public class ProtoTypeCitation {
    public static void main(String[] args) throws CloneNotSupportedException{
       Citation citation=new Citation("张三","同学：在2016学年第一学期中表现优秀，被评为三好学生。","韶关学院");
        citation.display();
        Citation citation2= (Citation) citation.clone();
        citation2.setName("lisi");
        citation2.display();
    }
}
@Data
class  Citation implements  Cloneable{
    String name;
    String info;
    String college;
    Citation(String name,String info,String college)
    {
        this.name=name;
        this.info=info;
        this.college=college;
        System.out.println("奖状创建成功！");
    }

    void display()
    {
        System.out.println(name+info+college);
    }
    public  Object clone() throws  CloneNotSupportedException{
        System.out.println("具体原型复制成功！");
        return  (Citation)super.clone();
    }

}